package com.azxc.rapid.plus.user.feign;

import com.azxc.rapid.core.tenant.annotation.NonDS;
import com.azxc.rapid.core.tool.api.R;
import com.azxc.rapid.core.tool.utils.Func;
import com.azxc.rapid.plus.user.service.IUserSearchPlusService;
import com.azxc.rapid.system.user.entity.User;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * @author linym
 * @className: UserSearchPlusClient
 * @description:
 * @date 2022/8/23 15:56
 * @version：1.0
 */
@NonDS
@ApiIgnore
@RestController
@AllArgsConstructor
public class UserSearchPlusClient implements IUserSearchPlusClient {

	private final IUserSearchPlusService service;


	@Override
	@GetMapping(LIST_BY_USER)
	public R<List<User>> listByUser(String userId) {
		return R.data(service.listByUser(Func.toLongList(userId)));
	}

	@Override
	@GetMapping(LIST_BY_DEPT)
	public R<List<User>> listByDept(String deptId) {
		return R.data(service.listByDept(Func.toLongList(deptId)));
	}

	@Override
	@GetMapping(LIST_BY_POST)
	public R<List<User>> listByPost(String postId) {
		return R.data(service.listByPost(Func.toLongList(postId)));
	}

	@Override
	@GetMapping(LIST_BY_ROLE)
	public R<List<User>> listByRole(String roleId) {
		return R.data(service.listByRole(Func.toLongList(roleId)));
	}
}
